package com.gt.config;

import com.gt.interceptor.EncodingInterceptor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.Arrays;


/*
 * @功能说明：拦截器配置
 * @作者： herun
 * @创建日期：2021/8/20
 * @版本号：V1.0
 */
@SpringBootConfiguration
@Order(-99)
public class InterceptorConfig extends WebMvcConfigurerAdapter {


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new EncodingInterceptor()).addPathPatterns("/**").excludePathPatterns(Arrays.asList("/**/*.*"));
    }

    /**
     * 配置静态访问资源
     *
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        super.addResourceHandlers(registry);
    }


}
